import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
        path: "/",
        component: () =>
            import ("@/views/index.vue"),
        redirect: "/syadd",
        children: [{
            // 首页
            path: "/syadd",
            component: () =>
                import ("@/views/index/syadd.vue")
        }, {
            // 详情
            path: "/sjxq/",
            component: () =>
                import ("@/views/item/sjxq.vue")
        }, {
            // 全部商品
            path: "/text",
            component: () =>
                import ("@/views/index/text.vue"),
            redirect: "/flall",
            children: [{
                path: "/flall",
                component: () =>
                    import ("@/views/index/text/flall.vue")
            }, {
                path: "/fl/",
                component: () =>
                    import ("@/views/index/text/fl.vue")
            }]
        }, {
            //关于我们
            path: "/my",
            component: () =>
                import ("@/views/index/my.vue")
        }, {
            path: "/love",
            component: () =>
                import ("@/views/item/love.vue")
        }, {
            path: "/cart",
            component: () =>
                import ("@/views/item/cart.vue")
        }]
    },
    {
        path: "/login",
        component: () =>
            import ("@/views/login.vue")
    }, {
        path: "*",
        redirect: "/"
    }
]

const router = new VueRouter({
    routes
})

export default router